//
//  WJCDefine.h
//  WJCPack
//
//  Created by wjc on 2022/2/8.
//

#ifndef WJCDefine_h
#define WJCDefine_h
#import "saveSandBox.h"
#ifdef DEBUG // 开发阶段-DEBUG阶段:使用Log
#define WJCLog(...) NSLog(__VA_ARGS__)
#else // 发布阶段-上线阶段:移除Log
#define WJCLog(...)
#endif
    // 方法输出
#define WJCLogFunc WJCLog(@"%s", __func__);

#define imageName(imageName, bunldeName) [NSBundle imageNamedFromMyBundle:imageName andBundleClass:[self class] andBundleName:bunldeName]

#define localChanged(key,annotation,bunldeName) [NSBundle localizedStringForKey:key value:annotation andBundleClass:[self class] andBundleName:bunldeName]


    // 屏幕尺寸
#define WJCScreenH [UIScreen mainScreen].bounds.size.height
#define WJCScreenW [UIScreen mainScreen].bounds.size.width

//沙盒
#define FCUserDefaults [NSUserDefaults standardUserDefaults]

// 是否为IPhoneX
#define IPhoneX ([UIScreen mainScreen].bounds.size.height > 810.0)
    // 适配iPhone X 状态栏高度
#define WJCStatusBarHeight (IPhoneX ? 44.f : 22.f)
    // 适配iPhone X Tabbar距离底部的距离
#define WJCTabbarSafeBottomMargin (IPhoneX ? 34.f : 0.f)
    // 适配iPhone X Tabbar高度
#define WJCTabbarHeight (IPhoneX ? 83.f : 49.f)
    // 适配iPhone X 导航栏高度
#define WJCNavBarHeight (IPhoneX ? 90.f : 64.f)
    // 适配bottomView遮挡距离
#define WJCSafeBottomMargin (IPhoneX ? 30.f : 0.f)
//底部按钮高度
#define WJCBottomBtnHeight (IphonePlus ? 44.f : 40)

/**系统字体*/
#define WJCSystemFont(__VA_ARGS__) ([UIFont systemFontOfSize:(__VA_ARGS__)])
/**全局字体*/
#define WJCGlobelFont(__VA_ARGS__) ([UIFont systemFontOfSize:WJCScaleFont(__VA_ARGS__)])
/**字体比例*/
#define WJCScaleFont(__VA_ARGS__)  (WJCScreenW/375)*(__VA_ARGS__)
/**宽度比例*/
#define WJCScaleWidth(__VA_ARGS__)  (WJCScreenW/375)*(__VA_ARGS__)
/**高度比例*/
#define WJCScaleHeight(__VA_ARGS__)  (WJCScreenH/667)*(__VA_ARGS__)



//颜色
#define WJCARGBColor(r, g, b,a) [UIColor colorWithRed:(r)/255.0 green:(g)/255.0 blue:(b)/255.0 alpha:(a)/255.0]
#define WJCColor(r, g, b) WJCARGBColor( (r), (g), (b),255)
#define HEXC(rgbValue) [UIColor colorWithRed:((float)((rgbValue & 0xFF0000) >> 16))/255.0 green:((float)((rgbValue & 0xFF00) >> 8))/255.0 blue:((float)(rgbValue & 0xFF))/255.0 alpha:1.0]
#define HEXAC(rgbValue,a) [UIColor colorWithRed:((float)((rgbValue & 0xFF0000) >> 16))/255.0 green:((float)((rgbValue & 0xFF00) >> 8))/255.0 blue:((float)(rgbValue & 0xFF))/255.0 alpha:(a)]



//字体
// 自定义字体大小
#define font(Size) [UIFont fontWithName:@"PingFangSC-Light" size:Size]//[UIFont systemFontOfSize:Size]
#define Bfont(Size) [UIFont fontWithName:@"PingFangSC-Semibold" size:Size]
#define Mfont(Size) [UIFont fontWithName:@"PingFangSC-Medium" size:Size]

#define quickSetRequestLoad(obj , path, requestDt,mjcls,mjstrCls) obj.urlPath = path;\
obj.requestData = requestDt;\
obj.mjClass =mjcls;\
obj.requestStrMJClass = mjstrCls;

/**字体比例*/
#define FCScaleFont(__VA_ARGS__)  (WJCScreenW/375)*(__VA_ARGS__)
/**宽度比例*/
#define FCScaleWidth(__VA_ARGS__)  (WJCScreenW/375)*(__VA_ARGS__)
/**高度比例*/
#define FCScaleHeight(__VA_ARGS__)  (WJCScreenH/667)*(__VA_ARGS__)
// 常用字体大小
#define font20 [UIFont systemFontOfSize:WJCScaleFont(20)]
#define font18 [UIFont systemFontOfSize:WJCScaleFont(18)]
#define font17 [UIFont systemFontOfSize:WJCScaleFont(17)]
#define font16 [UIFont systemFontOfSize:WJCScaleFont(16)]
#define font15 [UIFont systemFontOfSize:WJCScaleFont(15)]
#define font14 [UIFont systemFontOfSize:WJCScaleFont(14)]
#define font13 [UIFont systemFontOfSize:WJCScaleFont(13)]
#define font12 [UIFont systemFontOfSize:WJCScaleFont(12)]
#define font11 [UIFont systemFontOfSize:WJCScaleFont(11)]
#define font10 [UIFont systemFontOfSize:WJCScaleFont(10)]
#define font9 [UIFont systemFontOfSize:WJCScaleFont(9)]
//加粗字体
//加粗字体
#define Bfont20 [UIFont fontWithName:@"Helvetica-Bold" size:WJCScaleFont(20)]
#define Bfont18 [UIFont fontWithName:@"Helvetica-Bold" size:WJCScaleFont(18)]
#define Bfont17 [UIFont fontWithName:@"Helvetica-Bold" size:WJCScaleFont(17)]
#define Bfont16 [UIFont fontWithName:@"Helvetica-Bold" size:WJCScaleFont(16)]
#define Bfont15 [UIFont fontWithName:@"Helvetica-Bold" size:WJCScaleFont(15)]
#define Bfont14 [UIFont fontWithName:@"Helvetica-Bold" size:WJCScaleFont(14)]
#define Bfont13 [UIFont fontWithName:@"Helvetica-Bold" size:WJCScaleFont(13)]
#define Bfont12 [UIFont fontWithName:@"Helvetica-Bold" size:WJCScaleFont(12)]
#define Bfont10 [UIFont fontWithName:@"Helvetica-Bold" size:WJCScaleFont(10)]
#define Bfont9 [UIFont fontWithName:@"Helvetica-Bold" size:WJCScaleFont(9)]

    //设置 view 圆角和边框
#define WJCLRViewBorderRadius(View, Radius, Width, Color)\
\
[View.layer setCornerRadius:(Radius)];\
[View.layer setMasksToBounds:YES];\
[View.layer setBorderWidth:(Width)];\
[View.layer setBorderColor:[Color CGColor]]

    //设置 边框
#define WJCLRViewBorderWidth(View, Width, Color)\
\
[View.layer setBorderWidth:(Width)];\
[View.layer setBorderColor:[Color CGColor]]

//设置 view 圆角

#define WJCSETLRViewBorderRadius(View, Radius)\
[View.layer setCornerRadius:(Radius)];\
[View.layer setMasksToBounds:YES]


//沙盒
#define WJCUserDefaults [NSUserDefaults standardUserDefaults]

    // 弱引用
#define WJCWeakSelf __weak __typeof__(self) weakSelf = self;
#define NSNotificationCenterPost(obj,pstName) [[NSNotificationCenter defaultCenter] postNotificationName:pstName object:obj];
#define NSNotificationCenterAdd(selectFunc,nameNot) [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(selectFunc) name:nameNot object:nil];
#define WeakType(obj) __weak typeof(obj) weak##obj = obj;
//bunner高度
#define WJCBunnerH (WJCScreenW / 2.68)



#import "UIView+viewExtension.h"
#import "UIImageView+WJCDownload.h"
#import "NSString+XMGExtension.h"
#import "SVProgressHUD.h"
#import "MJExtension.h"
#import "Masonry.h"
#import "FCCGetCurrentVcTool.h"
#import "WJCDeployModel.h"
#import "NSDictionary+JsonPrintf.h"
#import "NSObject+KVCChangeType.h"
#define WJCTextFieldSetPlaceholderValueKeyPath(textField ,Placeholder, Value, KeyPath)\
\
if (@available(iOS 13.0, *)) {\
    textField.attributedPlaceholder = [[NSAttributedString alloc] initWithString:Placeholder attributes:@{NSForegroundColorAttributeName:Value}];\
} else {\
    textField.placeholder = Placeholder;\
    [textField setValue:Value forKeyPath:KeyPath];\
}\


#define SuppressPerformSelectorLeakWarning(Stuff) \
do { \
_Pragma("clang diagnostic push") \
_Pragma("clang diagnostic ignored \"-Warc-performSelector-leaks\"") \
Stuff; \
_Pragma("clang diagnostic pop") \
} while (0)
#define IOS11            ([[[UIDevice currentDevice] systemVersion] doubleValue] >= 11.0)
#define IOS10Lower            ([[[UIDevice currentDevice] systemVersion] doubleValue] < 10.0)


#define dispatch_sync_main_safe(block)\
if ([NSThread isMainThread]) {\
block();\
} else {\
dispatch_sync(dispatch_get_main_queue(), block);\
}

#define dispatch_async_main_safe(block)\
if ([NSThread isMainThread]) {\
block();\
} else {\
dispatch_async(dispatch_get_main_queue(), block);\
}


#define createLineView(name)\
UIView *name=[UIView new];\
name.frame=CGRectMake(0, 0, WJCScreenW, 0.25);\
name.backgroundColor=HEXC(0xD8D8D8);

#define createCommonLabel(labelName,fontT,tColor)\
UILabel *labelName=[[UILabel alloc] initWithFrame:CGRectMake(0, 0, WJCScreenW,35)];\
labelName.font=fontT;\
labelName.textColor=tColor;

#define createCommonLabel(labelName,fontT,tColor)\
UILabel *labelName=[[UILabel alloc] initWithFrame:CGRectMake(0, 0, WJCScreenW,35)];\
labelName.font=fontT;\
labelName.textColor=tColor;

#define createSubLabel(containerName,labelName,fontT,tColor)\
({\
    UILabel *labelName=[[UILabel alloc] initWithFrame:CGRectMake(0, 0, WJCScreenW,35)];\
    labelName.font=fontT;\
    labelName.textColor=tColor;\
    [containerName addSubview:labelName];\
    (labelName);\
})\

#define createInitType(containerName,labelName)\
({\
    containerName *labelName = [[containerName alloc] init];\
})\

#define createCommonBtn(btnName,fontT,tColor)\
UIButton *btnName=[UIButton buttonWithType:UIButtonTypeCustom];\
btnName.titleLabel.font=fontT;\
[btnName setTitleColor:tColor forState:UIControlStateNormal];

#define setViewCornerRadius(viewName , radius)\
viewName.layer.cornerRadius = radius;\
viewName.layer.masksToBounds = YES;

#define createSubBtn(containerName,btnName,fontT,tColor)\
({\
UIButton *btnName=[UIButton buttonWithType:UIButtonTypeCustom];\
btnName.titleLabel.font=fontT;\
[btnName setTitleColor:tColor forState:UIControlStateNormal];\
[containerName addSubview:btnName];\
(btnName);\
})\

#define createSubImageView(containerName,imageViewName,imgName)\
({\
UIImageView *imageViewName=[[UIImageView alloc] init];\
imageViewName.image = [UIImage imageNamed:imgName];;\
[containerName addSubview:imageViewName];\
(imageViewName);\
})\


#define createTable(btnName,tableViewStyle,backColor,setMJ)\
UITableView *btnName=[[UITableView alloc]initWithFrame:CGRectMake(0, 0, WJCScreenW, WJCScreenH-64) style:tableViewStyle];\
btnName.backgroundColor=backColor;\
if (setMJ) {\
    btnName.mj_header = [MJRefreshNormalHeader headerWithRefreshingTarget:self refreshingAction:@selector(loadNewData)];\
    btnName.mj_footer = [MJRefreshAutoNormalFooter footerWithRefreshingTarget:self refreshingAction:@selector(loadMoreData)];\
}
#endif /* WJCDefine_h */
